const {
  Random
} = require("mockjs")
const Mock = require("mockjs")
const Hotel = require("../model/Hotel")


//创建数据的函数
async function hotelData(owenerId) {
  //酒店列表数据
  const {
    hotelList
  } = Mock.mock({
    "hotelList|20": [{
      'goodsId': '@id',
      'owenerId': owenerId,
      'city': '@county(true)' + " @cword(10)",
      'title|5-10': '@cword',
      'visitor|2-8': 0,
      'bedNum|1-4': 0,
      'roomNum|1-3': 0,
      'bathNum|1-3': 0,
      'price|128-699': 0,
      'picUrl': Random.image("300x200", "#f66", "#FFF", "@word(10)"),
      'tite|1': [
        ["近公交站", "可以做饭", "江景房"],
        ["近商圈", "可以停车"],
        ["可以唱歌", "提供早餐", "近景点", "近地铁站"],
        ["江景房", "提供早餐", "近地铁站"],
        ["江景房", "提供早餐", "近地铁站"],
        ["近公交站", "近景点", "可以停车"],
        ["可以停车", "可以唱歌", "有麻将桌", "近商圈"],
      ],
      'offical|20-40': '@cword',
      'score|2-5': 0,
      'likeygoodNum|10-1000':0
    }]
  })
  const res = await Promise.all(
    hotelList.map((item) => {
      // console.log(item);
      return Hotel.create(item)
    })
  )
}


module.exports = hotelData